package cn.mw.controller;

import cn.mw.domain.Floor;
import cn.mw.service.IFloorService;
import cn.mw.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/build")
public class FloorController {
    @Autowired
    private IFloorService floorService;
    @PostMapping("/addFloor")
    public JSONResult addFloor(@RequestBody List<Floor> floors){
        try {
            floorService.addFloor(floors);
            return  JSONResult.success("操作成功");
        } catch (Exception e) {
            System.out.println(e.getMessage());
            return JSONResult.success("操作失败");
        }
    }
    @GetMapping("/getfloor/{bulidId}")
    public List<Floor> getfloor(@PathVariable ("bulidId") String bulidId) {
        return floorService.getfloor(bulidId);
    }
}
